﻿
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[sproc_CM_GetCallinContact]') AND type in (N'P', N'PC'))
    DROP PROCEDURE [dbo].[sproc_CM_GetCallinContact];
GO
CREATE PROCEDURE [dbo].[sproc_CM_GetCallinContact]

@begintime datetime,
@endtime datetime
AS
    SELECT * FROM UDS_CM_ClientContact
    WHERE 
     (patindex('%callin%',UDS_CM_ClientContact.ContactType)>=0
    OR patindex('%interview%',UDS_CM_ClientContact.ContactType)>=0
    OR patindex('%meeting%',UDS_CM_ClientContact.ContactType)>=0)
    AND contacttime between @begintime and dateadd(day,1,@endtime)